home *** CD-ROM | disk | FTP | other *** search
/ 64'er 1988 June / 64er_Magazin_88-06_1988_Markt__Technik_de_Side_A.d64 / f-plot 1520 v2.0 (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  4KB  |  166 lines

  1. 10 rem ************************
  2. 15 rem *** f-plot 1520 v2.0 ***
  3. 20 rem *** hamburg 1986     ***
  4. 30 rem *** by ingo jaenicke ***
  5. 40 rem ************************
  6. 41 rem
  7. 42 rem angeregt zu diesem programm
  8. 43 rem wurde ich durch ein aehnliches,
  9. 44 rem aber in vieler hinsicht unzu-
  10. 45 rem reichendes programm von heimo
  11. 46 rem ponnath, das im 64'er 11/85
  12. 47 rem s.153 veroeffentlicht wurde.
  13. 48 rem
  14. 50 poke53280,0:poke53281,0:poke646,14:poke2,3
  15. 54 :
  16. 55 rem ****** funktionseingabe ******
  17. 56 :
  18. 60 gosub1000
  19. 80 print"             geben sie ein:         "
  20. 85 input"f(x)=";f$
  21. 90 print"[147][144]110f$="chr$(34)f$chr$(34)
  22. 91 print"115deffnf(x)="f$
  23. 92 print"111xl="xl":xr="xr:print"112yl="yl":yr="yr":bs="bs
  24. 95 print"113ix="ix":iy="iy":yg="yg
  25. 96 print518-peek(2)"f$("peek(2)")="chr$(34)f$chr$(34)
  26. 97 print"goto110"
  27. 100 printchr$(19):poke631,13:poke632,13:poke633,13
  28. 105 poke634,13:poke635,13:poke636,13:poke637,13:poke198,7:end
  29. 110 f$=".5*x"
  30. 111 xl=-5 :xr= 5
  31. 112 yl=-3 :yr= 3 :bs= 160
  32. 113 ix= 10 :iy= 6 :yg= 144
  33. 115 deffnf(x)=.5*x
  34. 116 open4,6:open1,6,1:open2,6,2:open3,6,3:open5,6,5
  35. 117 :
  36. 118 rem *** intervall-eingabe ***
  37. 119 :
  38. 123 ifpeek(2)<3then400
  39. 125 c$="                                      ":gosub1000
  40. 130 print"x-intervall von";:inputxl
  41. 135 print"[145]:bis";:inputxr:print"[145]"tab(26)":"
  42. 140 ix=abs(xr-xl):ifxl>=xrthenprint"[145]"c$"[145][145][145]":goto130
  43. 145 print"(y-intervall darf nicht"
  44. 150 print"groesser als"ix*2"sein !)[145][145][145][145][145][154]"
  45. 155 print"y-intervall von";:inputyl
  46. 160 print"[145]:bis";:inputyr:print"[145]"tab(26)":"
  47. 165 ifyl>=yrthenprint"[145]"c$"[145][145]":goto155
  48. 170 iy=abs(yr-yl):ifiy>ix*2thenprint"[145]"c$"[145][145]":goto155
  49. 175 print""c$:printc$
  50. 180 print"[145]anzahl der berechnungsschritte  160[157][157][157][157][157]";:inputbs
  51. 185 ifbs>479thenprint"[145]"c$:goto180
  52. 190 print"[145]"tab(32)":"
  53. 207 :
  54. 208 rem *** vorbereitende schritte ***
  55. 209 :
  56. 210 yg=iy*240/ix
  57. 215 print#2,0:print#1,"m",0,-yg:print#1,"i"
  58. 220 print#1,"j",0,-yg:print#1,"j",479,-yg
  59. 225 print#1,"j",479,yg:print#1,"j",0,yg
  60. 230 print#1,"j",0,0
  61. 232 :
  62. 233 rem ***  ko-system potten ***
  63. 234 :
  64. 235 print#5,3:ifsgn(yl)=sgn(yr)then247
  65. 240 xa=abs(yl)*2*yg/iy:print#1,"r",0,xa-yg:print#1,"j",479,xa-yg:fx=1
  66. 247 ifsgn(xl)=sgn(xr)then255
  67. 250 ya=abs(xl)*480/ix:print#1,"r",ya,yg:print#1,"j",ya,-yg:fy=1
  68. 255 print#5,0:print#1,"r",0,0
  69. 256 :
  70. 257 rem *** achsenabscnitte plotten ***
  71. 258 :
  72. 260 ifix>25then950
  73. 265 iffx=0then300
  74. 270 fx=0:ifxl<0thenxb=(int(xl)+1-xl)*480/ix:goto280
  75. 275 xb=(xl-int(xl))*480/ix
  76. 280 xc=480/ix
  77. 285 fori=0toix-1:print#1,"r",xb+xc*i,xa-yg+3
  78. 290 print#1,"j",xb+xc*i,xa-yg-3
  79. 295 nexti
  80. 300 iffy=othen335
  81. 305 fy=0:ifyl<0thenyb=(int(yl)+1-yl)*2*yg/iy:goto315
  82. 310 yb=(yl-int(yl))*2*yg/iy
  83. 315 yc=2*yg/iy
  84. 320 fori=0toiy-1:print#1,"r",ya-3,-yg+yb+yc*i
  85. 325 print#1,"j",ya+3,-yg+yb+yc*i
  86. 330 nexti
  87. 332 :
  88. 333 rem *** einheitszahlen plotten ***
  89. 334 :
  90. 335 print#3,0:print#1,"r",0,xa-yg:print#1,"i"
  91. 340 ifxr<(ix/30)oryl>(-7*iy/yg)then347
  92. 341 ifxl>0oryr<0then347
  93. 345 print#1,"r",ya+5,-12:print#4,"0":print#1,"m",0,22:print#1,"i"
  94. 347 ifxr<(1+(ix/120))oryl>(-8*iy/yg)then353
  95. 348 ifxl>(1-(ix/120))oryr<0then353
  96. 350 print#1,"r",ya+yc-2,-14:print#4,"1":print#1,"m",0,24:print#1,"i"
  97. 353 ifxr<(ix*7/240)oryl>(-1-(4*iy/yg))then360
  98. 354 ifxl>0oryr<(-1+(4*iy/yg))then360
  99. 355 print#1,"r",ya+6,-yc-5:print#4,"-1":print#1,"m",0,yc+15:print#1,"i"
  100. 360 print#1,"r",0,yg-xa:print#1,"i"
  101. 397 :
  102. 398 rem *** plotten der funktion ***
  103. 399 :
  104. 400 gosub1000:print#2,peek(2):fw(0)=fnf(xl)
  105. 405 iffw(0)<ylthenprint#1,"r",0,-yg:goto420
  106. 410 iffw(0)>yrthenprint#1,"r",0,yg:goto420
  107. 415 print#1,"r",0,-yg+(abs(fw(0)-yl)*2*yg/iy)
  108. 420 forx=(xl+ix/bs)toxrstepix/bs
  109. 425 fw(1)=fnf(x)
  110. 430 iffw(0)>yrandfw(1)>yrthenbm$="r":fp=yg:goto465
  111. 435 iffw(0)>yrandfw(1)<ylthenbm$="j":fp=-yg:goto465
  112. 440 iffw(0)<ylandfw(1)>yrthenbm$="j":fp=yg:goto465
  113. 445 iffw(0)<ylandfw(1)<ylthenbm$="r":fp=-yg:goto465
  114. 450 iffw(1)>yrthenbm$="j":fp=yg:goto465
  115. 455 iffw(1)<ylthenbm$="j":fp=-yg:goto465printyg
  116. 460 bm$="j":fp=-yg+(abs(fw(1)-yl)*2*yg/iy)
  117. 465 print#1,bm$,abs(x-xl)*480/ix,fp
  118. 470 fw(0)=fw(1):nextx
  119. 475 print#1,"r",0,0
  120. 477 :
  121. 478 rem *** weitere funktionen ? ***
  122. 479 :
  123. 480 ifpeek(2)=0thengoto515
  124. 485 gosub1000:print"    soll noch eine weitere funktion"
  125. 490 print"      in dieses koordinatensystem"
  126. 495 print"        geplottet werden (j/n) ?"
  127. 500 getb$:ifb$="n"then515
  128. 505 ifb$<>"j"then500
  129. 510 poke2,peek(2)-1:goto60
  130. 512 :
  131. 513 rem *** abschliessende schritte ***
  132. 514 :
  133. 515 f$( 3 )="x^2"
  134. 516 f$( 2 )=".5*x"
  135. 517 f$(1)=""
  136. 518 f$(0)=""
  137. 519 :
  138. 520 f$="":gosub1000:print#1,"r",0,-yg-10:print#4
  139. 525 print#2,0:print#3,1
  140. 530 print#4,"i :  ["xl","xr"]"
  141. 535 print#4,"i :  ["yl","yr"]"
  142. 540 print#3,0:print#1,"m",13,39
  143. 545 print#4,"x":print#4:print#1,"m",13,0:print#4,"y":print#3,1:print#4
  144. 550 fori=3topeek(2)step-1
  145. 555 print#2,i
  146. 560 iflen(f$(i))<35then575
  147. 565 print#4,"[198]([216])="left$(f$(i),35)
  148. 570 print#4,"     "mid$(f$(i),36,len(f$(i))-35):goto580
  149. 575 print#4,"[198]([216])="f$(i)
  150. 580 nexti
  151. 585 print#2,0:print#3,0:print#1,"m",396,5
  152. 590 print#4,"([195])'86 [194][217] i.j.":print#3,1:print#4:print#4:print#4:print#4
  153. 595 close1:close2:close3:close4:close5
  154. 600 print"n[146]eues koordinatensystem":print"oder"
  155. 605 print"p[146]rogrammende ?"
  156. 610 getb$:ifb$="p"thensys64738
  157. 615 ifb$<>"n"then610
  158. 620 goto60
  159. 997 :
  160. 998 rem *** up-kopfzeile ***
  161. 999 :
  162. 1000 print"[147][150]    funktionen-plot auf dem vc-1520[154]"
  163. 1001 a$="[195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195][195]"
  164. 1010 printa$:print"[145]f(x)="f$:printa$
  165. 1020 return
  166.